package com.yy.wga.income.service.listener;

import com.yy.wga.mp.module.income.dto.OrderCommissionDTO;
import com.yy.wga.mp.module.income.manager.OrderCommissionManager;
import com.yy.wga.mp.module.income.manager.OrderUpGradeCommissionManager;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @Author: gc
 * @Date: 2024/10/26
 * @Description:
 **/
@Component
@RequiredArgsConstructor
public class OrderCommissionEventListener implements ApplicationListener<OrderCommissionDTO> {
    private final OrderCommissionManager orderCommissionManager;
    private final OrderUpGradeCommissionManager orderUpGradeCommissionManager;

    /**
     * 订单分佣
     * @param event
     */
    @Async
    public void onApplicationEvent(OrderCommissionDTO event) {
        orderCommissionManager.commission(event);
    }
}
